import request from '@/utils/request'

//身份信息校验
export function validateIdNo(rule, value,callback) {
  const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
  if(value==''||value==undefined||value==null){
    callback();
  }else {
    if ((!reg.test(value)) && value != '') {
      callback(new Error('请输入正确的身份证号码'));
    } else {
      callback();
    }
  }
}


// 查询单独患者信息
export function findPatient(query) {
  return request({
    url: '/outpatient/patient/list',
    method: 'get',
    params: query
  })
}

// 查询挂号信息
export function findRegister(query) {
  return request({
    url: '/outpatient/register/list2',
    method: 'get',
    params: query
  })
}

// 查询挂号信息选择器
export function findRegisterType(query) {
  return request({
    url: '/outpatient/register/list3',
    method: 'get',
    params: query
  })
}

// 查询科室列表信息选择器
export function findDeptList(query) {
  return request({
    url: '/outpatient/patient/list4',
    method: 'get',
    params: query
  })
}
// 查询患者信息下拉框
export function findPatientList(query) {
  return request({
    url: '/outpatient/patient/list5',
    method: 'get',
    params: query
  })
}

// 新增患者
export function addpatient(data) {
  return request({
    url: '/outpatient/patient',
    method: 'post',
    data: data
  })
}

// 新增挂号单
export function addRegister(data) {
  return request({
    url: '/outpatient/register',
    method: 'post',
    data: data
  })
}

//医生下拉框
export function selectDoctorList(query) {
  return request({
    url: '/outpatient/doctor/list6',
    method: 'get',
    data: query
  })
}
